home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Temático 40 Febrero 2004.iso / DOS / ntfs / user / ntfstypes.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-11  |  3.0 KB  |  135 lines

  1. /*
  2.  *  types.h
  3.  *  This file defines four things:
  4.  *   - generic platform independent fixed-size types (e.g. ntfs_u32)
  5.  *   - specific fixed-size types (e.g. ntfs_offset_t)
  6.  *   - macros that read and write those types from and to byte arrays
  7.  *   - types derived from OS specific ones
  8.  *
  9.  *  Copyright (C) 1996,1998 Martin von L÷wis
  10.  */
  11.  
  12. #ifdef _MSC_VER
  13. #include <nttypes.h>
  14. #endif
  15.  
  16. #ifdef HAVE_CONFIG_H
  17. #include "config.h"
  18. #endif
  19.  
  20. #ifdef HAVE_ENDIAN_H
  21. #include <endian.h>
  22. #else
  23. #if defined(i386) || defined(__i386__)
  24. #define __LITTLE_ENDIAN
  25. #endif
  26. #endif /* HAVE_ENDIAN */
  27.  
  28. /* integral types */
  29. #ifndef NTFS_INTEGRAL_TYPES
  30. #define NTFS_INTEGRAL_TYPES
  31.  
  32. #ifdef HAVE_INTTYPES_H
  33.  
  34. #include <inttypes.h>
  35. typedef uint8_t  ntfs_u8;
  36. typedef uint16_t ntfs_u16;
  37. typedef uint32_t ntfs_u32;
  38. typedef uint64_t ntfs_u64;
  39. typedef int8_t ntfs_s8;
  40. typedef int16_t ntfs_s16;
  41. typedef int32_t ntfs_s32;
  42. typedef int64_t ntfs_s64;
  43.  
  44. #else /* HAVE_INTTYPES_H */
  45.  
  46. #if defined(i386) || defined(__i386__)
  47. typedef unsigned char      ntfs_u8;
  48. typedef unsigned short     ntfs_u16;
  49. typedef unsigned int       ntfs_u32;
  50. typedef unsigned long long ntfs_u64;
  51. typedef char      ntfs_s8;
  52. typedef short     ntfs_s16;
  53. typedef int       ntfs_s32;
  54. typedef long long ntfs_s64;
  55. #endif
  56.  
  57. #endif /*HAVE_INTTYPES_H */
  58. #endif /*NTFS_INTEGRAL_TYPES */
  59.  
  60. #if defined(i386) || defined(__i386__)
  61. /* unicode character type */
  62. #ifndef NTFS_WCHAR_T
  63. #define NTFS_WCHAR_T
  64. typedef unsigned short     ntfs_wchar_t;
  65. #endif
  66. /* file offset */
  67. #ifndef NTFS_OFFSET_T
  68. #define NTFS_OFFSET_T
  69. typedef unsigned long long ntfs_offset_t;
  70. #endif
  71. /* UTC */
  72. #ifndef NTFS_TIME64_T
  73. #define NTFS_TIME64_T
  74. typedef unsigned long long ntfs_time64_t;
  75. #endif
  76. /* This is really unsigned long long. So we support only volumes up to 2 TB */
  77. #ifndef NTFS_CLUSTER_T
  78. #define NTFS_CLUSTER_T
  79. typedef unsigned int ntfs_cluster_t;
  80. #define MAX_CLUSTER_T (~((ntfs_cluster_t)0))
  81. #endif
  82.  
  83. #else
  84. #error Put your machine description here
  85. #endif
  86.  
  87. #include "ntfsendian.h"
  88.  
  89. /* architecture independent macros */
  90.  
  91. /* PUTU32 would not clear all bytes */
  92. #define NTFS_PUTINUM(p,i)    NTFS_PUTU64(p,i->i_number);\
  93.                              NTFS_PUTU16(((char*)p)+6,i->sequence_number)
  94.  
  95. /* system dependent types */
  96. #ifdef HAVE_SYS_TYPES
  97. #ifndef NTMODE_T
  98. #define NTMODE_T
  99. typedef mode_t ntmode_t;
  100. #endif
  101. #ifndef NTFS_UID_T
  102. #define NTFS_UID_T
  103. typedef uid_t ntfs_uid_t;
  104. #endif
  105. #ifndef NTFS_GID_T
  106. #define NTFS_GID_T
  107. typedef gid_t ntfs_gid_t;
  108. #endif
  109. #ifndef NTFS_SIZE_T
  110. #define NTFS_SIZE_T
  111. typedef size_t ntfs_size_t;
  112. #endif
  113. #ifndef NTFS_TIME_T
  114. #define NTFS_TIME_T
  115. typedef time_t ntfs_time_t;
  116. #endif
  117. #else
  118. #ifndef _MSC_VER
  119. #include <sys/types.h>
  120. #include <sys/time.h>
  121. #include <sys/stat.h>
  122. typedef mode_t ntmode_t;
  123. typedef uid_t ntfs_uid_t;
  124. typedef gid_t ntfs_gid_t;
  125. typedef size_t ntfs_size_t;
  126. typedef time_t ntfs_time_t;
  127. #endif /* _MSC_VER */
  128. #endif /* __linux__ */
  129.  
  130. /*
  131.  * Local variables:
  132.  * c-file-style: "linux"
  133.  * End:
  134.  */
  135.